package FactoryMethod;
public class Factory {
    /**
     * @param fruitTypeName
     * @return
     */
    public static Fruit getFruitInstanceByType(String fruitTypeName) {
        // Fruit instanceOfFruitReturned = null;
        if (fruitTypeName == null) {
            throw new NullPointerException("FruitTypeName cannot be null");
        }
        if (fruitTypeName == "苹果") {
            return new AppleEntity();
        } else if (fruitTypeName == "橘子") {
            return new OrangeEntity();
        }else if (fruitTypeName == "香蕉") {
            return new BananaEntity();
        }

        return null;
    }
    }
